    //
//  logoViewController.m
//  _2010WorldCupNationalAthem
//
//  Created by Apple on 2010/7/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "logoViewController.h"
#import "_2010WorldCupNationalAthemAppDelegate.h"

#import "MainMenuViewController.h"


@implementation logoViewController

@synthesize logoButton ;




//**********************************************************
// Privtate method:  timeoutAndSwitchToMainMenu
//
//**********************************************************
- (void)timeoutAndSwitchToMainMenu:(id)sender 
{
	// stop timer	
	[timer invalidate];
	
	[timer release] ;
	timer = nil; // ensures we never invalidate an already invalid Timer
	
	// switch to main menu screen
	//
	MainMenuViewController * tempMainMenuView = 
	[[MainMenuViewController alloc]initWithNibName:@"MainMenuView" bundle:nil];
	
	[self.navigationController pushViewController:tempMainMenuView animated:YES] ;
	
	[tempMainMenuView release] ;
	
}


//**********************************************************
// Privtate method:  touchScrreToMainMenu
//
//**********************************************************

-(IBAction)touchButtonToMainMenu:(id)sender
{
	if(timer != nil)
	{
		[timer invalidate];
	
		[timer release] ;
		timer = nil;
	}
	
	
	// switch to main menu screen
	//
	MainMenuViewController * tempMainMenuView = 
		[[MainMenuViewController alloc]initWithNibName:@"MainMenuView" bundle:nil];
	
	[self.navigationController pushViewController:tempMainMenuView animated:YES] ;
	
	[tempMainMenuView release] ;
	

}



//**********************************************************
// overriding : viewDidLoad
//
//**********************************************************
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad 
{
	
#ifdef VOCAL_VERSION
	// change logo screen
	
	[logoButton setImage:[UIImage imageNamed:@"logo_vocal.JPG"] forState: UIControlStateHighlighted];
	[logoButton setImage:[UIImage imageNamed:@"logo_vocal.JPG"] forState: UIControlStateNormal];
		
#endif

    
	[super viewDidLoad];

	
	// copy-code start ~~~~~~~~~~~~~~~create a timer~~~~~~~~~~~~~
	//
	//
	
	//create a timer ==> when timeout, it would switch to Main Menu View automatically
	//
	timer = [[NSTimer scheduledTimerWithTimeInterval:3
														target:self 
														selector:@selector(timeoutAndSwitchToMainMenu:) 
													  userInfo:nil 
													   repeats:NO] retain] ;
	//
	// copy-code end ~~~~~~~~~~~~~~~create a timer~~~~~~~~~~~~~
}


/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView 
{
}
*/



/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload 
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
	
	logoButton = nil ;
}


- (void)dealloc 
{
	[logoButton release] ;
    [super dealloc];
}


@end
